package com.lishe.lishe.lishe.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by zhcase on 2017/9/6.
 */

public class ValidationUtils {

    private static final String TAG = ValidationUtils.class.getSimpleName();

    /**
     * 验证手机格式
     */
    public static boolean isMobileNO(String mobiles) {

        String MOBILE = "^1(3[0-9]|4[579]|5[0-35-9]|8[0-9]|7[0-9]|9[8-9]|6[6])\\d{8}$";
        if (mobiles == null || mobiles.equals("")) {
            return false;
        } else {
            Pattern p = Pattern.compile(MOBILE);
            Matcher m = p.matcher(mobiles);
            return m.matches();
        }
    }

    /**
     * @param pass
     * @return
     */
    public static boolean isLimitPass(String pass) {
        String limitEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>[表情]~！@①#￥%……&*（）——+|{}【】‘；：”“’。，、？]";
        Pattern pattern = Pattern.compile(limitEx);
        Matcher m = pattern.matcher(pass);

        if (m.find()) {
            return false;
        }
        return true;
    }
}
